package com.chinasofti.io;

import java.io.FileOutputStream;
import java.io.IOException;

public class Demo03 {
    public static void main(String[] args) {

        FileOutputStream fos = null;
        //创建文件输出流添加第二个参数(append:)true每写入文件内容则追加在尾部
        try {
            fos = new FileOutputStream("java0419\\fos.txt",true);
            for (int i = 0; i < 10; i++) {
                fos.write("hello".getBytes());
                fos.write("\n".getBytes());
            }
        }catch (IOException e){
            e.printStackTrace();
        }finally {
            try {
                fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }


    }
}
